package com.aweqy.hrmanager.controller;

import com.aweqy.hrmanager.entity.RoomType;
import com.aweqy.hrmanager.service.RoomTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/api/room-types")
public class RoomTypeController {
    @Autowired
    private RoomTypeService roomTypeService;

    @GetMapping
    public List<RoomType> list() {
        return roomTypeService.list();
    }

    @PostMapping
    public boolean add(@RequestBody RoomType roomType) {
        return roomTypeService.save(roomType);
    }

    @PutMapping
    public boolean update(@RequestBody RoomType roomType) {
        return roomTypeService.updateById(roomType);
    }

    @DeleteMapping("/{id}")
    public boolean delete(@PathVariable Integer id) {
        return roomTypeService.removeById(id);
    }
} 